package com.ilancuo.enuum;

/**
 * 交通灯
 * Created by ilancuo on 2018/4/8.
 */
enum Signal {
    GREEN, RED, YELLOW
}
public class Traffic {
    Signal color = Signal.RED;

    public void change() {
        switch (color) {
            case RED:
                color = Signal.GREEN;
                break;
            case YELLOW:
                color = Signal.RED;
                break;
            case GREEN:
                color = Signal.YELLOW;
                break;
            default:
                break;
        }
    }
}
